import {render,WeElement,define} from "omi"
import "../index/index.css"

define('return_index',class extends WeElement{
    config={
        navigationBarTitleText:"退换"
    }

    data={
        order_sn:"",    //订单号
        order_src:"",   //订单图
        order_name:"",  //订单名
        return_cont:[
            {
                name:"仅退款",    
                icon:require("../../../images/return_icon1.png"),
                content:"未收到货（包含未签收）或卖家协商同意前提下",
                arr_right:require("../../../images/arrows-right.png"),        
            },
            {
                name:"退货退款",             
                icon:require("../../../images/return_icon2.png"),
                content:"已收到货，需要退换已收到的货物",
                arr_right:require("../../../images/arrows-right.png"),
            },
            {
                name:"换货",   
                icon:require("../../../images/return_icon3.png"),
                content:"已收到货，需要更换已收到的货",
                arr_right:require("../../../images/arrows-right.png"),         
            },
            
        ]
    }
    toreturn=(option)=>{
        console.log(option.currentTarget.dataset)
        wx.navigateTo({
            url: '../return_apply/index?dataset='+option.currentTarget.dataset.to+"&order_sn="+this.data.order_sn+"&order_src="+this.data.order_src+"&order_pri="+this.data.order_pri+"&order_name="+this.data.order_name,
           
        });
          
    }
    install(e){
        console.log(e);
        this.data.order_sn=e.order_sn;
        this.data.order_src=e.order_src;
        this.data.order_pri=e.order_pri;
        this.data.order_name=e.order_name;
        this.update();
    }

    
    render(){

        return(
            <view class="body">
            <view class="order_box">

            <view class="order_picture">
            <image src={order_src}></image>
            </view>

            <view class="order_cont">
            <view class="cont">
            {order_name}
            </view>
            <view class="order_style">
            其它内容：如房型规格
            </view>
            </view>
            </view>

            {
                return_cont.map((item,index)=>
                <view class="return_box" key={index} data-to={item.name} bindtap="toreturn">

                    <view class="icon"><image src={item.icon}></image></view>

                    <view class="cont">
                    <view class="style">{item.name}</view>
                    <view class="descr">{item.content}</view>
                    </view>

                    <view class="arr_right">
                    <image src={item.arr_right}></image>
                    </view>

                </view>
                )}
        
            </view>
        )
    }


})